/*
apiStatus.js
*/

module.exports = {
	get success(){ return new getErrorStatus(0, 'Success'); },
	get serverError() { return new getErrorStatus(101, 'Server Error'); },
	get notImplement(){ return new getErrorStatus(102, 'Not Implement'); },
	get notFound(){ return new getErrorStatus(103, 'Not Found'); },
	get operationNotSupport(){ return new getErrorStatus(104, 'Operation not support in current status.'); },

	get requestInvalid(){ return new getErrorStatus(111, 'Request Invalid'); },
	get appTokenRequired(){ return new getErrorStatus(112, 'App-Token Required'); },
	get appTokenInvalid() { return new getErrorStatus(113, 'App-Token Invalid');},
	get appTokenTimeStampInvalid() { return new getErrorStatus(114, 'App-Token TimeStamp Invalid');},
	get jwtTokenRequired() { return new getErrorStatus(115, 'Jwt-Token Required');},
	get jwtTokenInvalid() { return new getErrorStatus(116, 'Jwt-Token Invalid');},
	get jwtTokenExpired() { return new getErrorStatus(117, 'Jwt-Token Expired');},

	get argumentInvalid() { return new getErrorStatus(201, 'Argument Invalid');},
	get loginInvalid() { return new getErrorStatus(202, ' Login is Fail');},

	get productNotExist() { return new getErrorStatus(301,'Product not Exists');},
	get productNoQuantity() { return new getErrorStatus(302,'No quantity available in stock');},
	get priceValidateFail() { return new getErrorStatus(303,'Price Validate Fail');},
	get orderNotExist() { return new getErrorStatus(304,'Order not Exists');},

};

module.exports.getErrorStatus = getErrorStatus;
module.exports.missArguments = function (argNames) {
	return getErrorStatus(202,"Miss Arguemnts: " + argNames.join(","));
}
module.exports.invalidArguments = function (argNames) {
	return getErrorStatus(202,"Invalid Arguemnts: " + argNames.join(","));
}

function getErrorStatus(code,msg){
	return {
		"statusCode": code,
		"statusMessage": msg
	};
};
